<template>
  <div class="wrappe">
    <swiper :options="swiperOption">
        <swiper-slide class="swiper-slide" v-for="(item,index) in list" :key="index">
             <div>
                 <img :src="item.icon" alt="">
             </div>
        </swiper-slide>
        <div class="swiper-pagination"  slot="pagination"></div>   <!-- 分页 -->
      </swiper>
  </div>
</template>

<script>

import { swiper, swiperSlide } from 'vue-awesome-swiper'
export default {
  name: "HomeSwiper",
  props: {
    list: {
        type:Array
    }
  },
  data() {
    return {
      //设置属性
      swiperOption: {
        //显示分页
        pagination: {
          el: '.swiper-pagination',
          clickable: true //允许分页点击跳转
        },
        //设置点击箭头
        navigation: {
          nextEl: '.swiper-button-next', 
          prevEl: '.swiper-button-prev'
        },
        //自动轮播
        autoplay: {
          delay: 1500
        },
        //开启循环模式
        loop: true,
        //开启鼠标滚轮控制Swiper切换
        mousewheel: true
      }
    };
  },
  components:{
      swiper,
      swiperSlide
  },
  computed: {
    showSwiper() {
      return this.list.length;
    }
  }
};
</script>

<style lang="less" scoped>
.wrappe{
    width: 100vw;
    position: relative;
    img{
        width: 100%;
        height: 1.5rem;
    }
}
.wrappe /deep/.swiper-pagination-bullet-active {
  background: #fff;
}
.wrappe {
  overflow: hidden;
  width: 100%;
  height: 0;
  padding-bottom: 1.5rem;
  background: #eee;
}

.swiper-img {
  width: 100%;
}
</style>